package com.haste.controller;

import com.haste.pojo.Dept;
import com.haste.service.DeptService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName:DeptController
 * @Description:
 * @Author:Haste
 * @Date:2021/2/1 17:41
 */
@RestController
public class DeptController {
    @Resource
    private DeptService deptService;

    @PostMapping("/dept/add")
    public boolean addDept(@RequestBody Dept dept){
        return deptService.addDept(dept);
    }

    @GetMapping("/dept/get/{deptId}")
    public Dept get(@PathVariable("deptId") Long deptId){
        return deptService.queryById(deptId);
    }

    @GetMapping("/dept/list")
    public List<Dept> queryAll(){
        return deptService.queryAll();
    }
}
